#include <iostream>
#include <stack>
#include <algorithm>
using namespace std;

class Solution 
{
public:
    void push(int value) 
    {
        minTmp = minS.empty() ? INT_MAX : minS.top();
        if (value < minTmp) 
        {
            minTmp = value;
        }
        minS.push(minTmp);
        stack1.push(value);
    }
    void pop() 
    {
        stack1.pop();
        minS.pop();
    }
    int top() 
    {
        return stack1.top();
    }
    int min() 
    {
        return minS.top();
    }
    stack<int> minS;
    stack<int> stack1;
    int minTmp = INT_MAX;
};